<html>
    <head>
        <title>原材料修改</title>
        <link href="{$Think.const.ADMIN_CSS_URL}bootstrap.css" rel="stylesheet" />
        <link href="{$Think.const.ADMIN_CSS_URL}lz-style.css" rel="stylesheet" />
        <script src="{$Think.const.ADMIN_JS_URL}jquery.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}jquery.form.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}bootstrap.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}DatePicker/WdatePicker.js"></script>
        <script language="JavaScript">

            $(function () {
                $('#editform').ajaxForm({
                    beforeSubmit: checkForm, // pre-submit callback
                    success: complete, // post-submit callback
                    dataType: 'json'
                });
                function checkForm() {

                    if ('' == $.trim($('#MaterialID').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALID}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialCode').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALCODE}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialName').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALNAME}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialTypeID').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALTYPEID}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialModel').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALMODEL}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialUnit').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALUNIT}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialIMG').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALIMG}]不能为空').show();
                        return false;
                    }

                }
                function complete(data) {
                    if (data.status === 1) {
                        $('#error').hide();
                        $('#success').html(data.info).show();
                    } else {
                        $('#success').hide();
                        $('#error').html(data.info).show();
                    }
                }

            });

        </script>

    </head>
    <body>
        <div class="container">
            <div class="row div_head" >
                <div class=" col-xs-6 col-sm-6 text-primary">
                              {$loction}
                </div>
                <div class="col-xs-6 col-sm-3"></div>
                <div class="col-xs-6 col-sm-3">
                    <a style="text-decoration: none" href="__CONTROLLER__/lst">【返回】</a>
                </div>
            </div>

            <hr />
            <div class="row div_form" >
                <form id="editform" action="__SELF__" method="post">
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialID" class="control-label">{$Think.const.LB_MATERIALID}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialID" name="MaterialID" class="form-control" placeholder="{$Think.const.LB_MATERIALID}"  value="{$post.materialid}" maxlength="42"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialCode" class="control-label">{$Think.const.LB_MATERIALCODE}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialCode" name="MaterialCode" class="form-control" placeholder="{$Think.const.LB_MATERIALCODE}"  value="{$post.materialcode}" maxlength="42"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialName" class="control-label">{$Think.const.LB_MATERIALNAME}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialName" name="MaterialName" class="form-control" placeholder="{$Think.const.LB_MATERIALNAME}"  value="{$post.materialname}" maxlength="100"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialTypeID" class="control-label">{$Think.const.LB_MATERIALTYPEID}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialTypeID" name="MaterialTypeID" class="form-control" placeholder="{$Think.const.LB_MATERIALTYPEID}"  value="{$post.materialtypeid}" maxlength="42"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialModel" class="control-label">{$Think.const.LB_MATERIALMODEL}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialModel" name="MaterialModel" class="form-control" placeholder="{$Think.const.LB_MATERIALMODEL}"  value="{$post.materialmodel}" maxlength="50"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialUnit" class="control-label">{$Think.const.LB_MATERIALUNIT}:</label></div>
                    <div class="col-xs-6 col-sm-3" >
        <select id="MaterialUnit" name="MaterialUnit" class="form-control" value="{$post.materialunit}"   required>
            <option value="" style="display: none"></option>
            <foreach name="GV_Enum.MaterialUnit" item="row" key="k">
            <if condition="$k eq $post.materialunit ">
            <option value="{$k}" selected = "selected" >{$k}-{$row}</option>
            <else />
            <option value="{$k}" >{$k}-{$row}</option>
            </if>
            </foreach>
        </select>
                    </div>
<div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialIMG" class="control-label">{$Think.const.LB_MATERIALIMG}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialIMG" name="MaterialIMG" class="form-control" placeholder="{$Think.const.LB_MATERIALIMG}"  value="{$post.materialimg}" maxlength="42"   required />
                    </div>
<div class="text-right col-xs-6 col-sm-3 " ><label for="MaterialSIMG" class="control-label">{$Think.const.LB_MATERIALSIMG}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialSIMG" name="MaterialSIMG" class="form-control" placeholder="{$Think.const.LB_MATERIALSIMG}"  value="{$post.materialsimg}" maxlength="42"    />
                    </div>
<div class="text-right col-xs-6 col-sm-3 " ><label for="MaterialDesc" class="control-label">{$Think.const.LB_MATERIALDESC}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialDesc" name="MaterialDesc" class="form-control" placeholder="{$Think.const.LB_MATERIALDESC}"  value="{$post.materialdesc}" maxlength="100"    />
                    </div>

                    <div class="col-xs-6 col-sm-3">
                        <input type="submit" id="search"  class="btn btn-default" value="提交">
                    </div>

                </form>
            </div>
            <div id="error" class="row text-danger"></div>
            <div id="success" class="row text-success"></div>

        </div>

    </body>
</html>
